from django.db import models


# Create your models here.
class UserInfo(models.Model):
    username = models.CharField(verbose_name='⽤户名', max_length=32)
    email = models.EmailField(verbose_name='邮箱', max_length=32)
    mobile_phone = models.CharField(verbose_name='⼿机号', max_length=32)
    password = models.CharField(verbose_name='密码', max_length=32)

    def __str__(self):
        return self.username


class VegInfo(models.Model):
    # 蔬菜具有的属性
    # 名字
    name = models.CharField(verbose_name='蔬菜名', max_length=20)
    # 数量
    number = models.PositiveIntegerField(verbose_name='数量')
    # 质量
    quality_choices = (
        (1, '坏'),
        (2, '一般'),
        (3, '好')
    )
    quality = models.SmallIntegerField(verbose_name='质量好坏', default=2,
                                       choices=quality_choices)
    # 入库时间
    in_time = models.DateTimeField(verbose_name='入库时间', auto_now_add=True)
    # 出产地
    from_place = models.CharField(verbose_name='出产地', max_length=50)
    # 价格
    price = models.PositiveIntegerField(verbose_name='价格')


class MeatInfo(models.Model):
    # 肉类具有的属性
    # 名字
    name = models.CharField(verbose_name='肉名', max_length=20)
    # 质量（单位斤）
    number = models.PositiveIntegerField(verbose_name='质量')
    # 肉质
    quality_choices = (
        (1, '坏'),
        (2, '一般'),
        (3, '好')
    )
    quality = models.SmallIntegerField(verbose_name='质量好坏', default=2,
                                       choices=quality_choices)
    # 入库时间
    in_time = models.DateTimeField(verbose_name='入库时间', auto_now_add=True)
    # 出产地
    from_place = models.CharField(verbose_name='出产地', max_length=50)
    # 价格
    price = models.PositiveIntegerField(verbose_name='价格')
